package librss;
/*
 * Constants.java
 *
 * Created on March 7, 2009, 12:34 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author alvaro
 */
public class Constantes {
    
    public String RSS_URL;
    public String NET_FILE = "net_items.rss";
    public String LOCAL_FILE = "items.rss";
    private String xmlFile;
    private String prefix;
    
    /** Creates a new instance of Constants */
    public Constantes(String prefix, String xmlFile)  throws Exception {
        this.prefix = prefix;
        this.xmlFile = xmlFile;
        this.loadConfiguration();
    }
    
    private void loadConfiguration() throws Exception {
        this.loadConfiguration(this.xmlFile);
    }
    
    public void loadConfiguration(String file) throws Exception {
        String xmlFile = file;
        XMLHandler xml = new XMLHandler(xmlFile);
        this.RSS_URL = xml.getTagText("/config/url");
        this.NET_FILE = prefix+xml.getTagText("/config/net_file");
        this.LOCAL_FILE = prefix+xml.getTagText("/config/local_file");
        //System.out.println("net_file: "+NET_FILE+" local_file: "+LOCAL_FILE);
    }
    
}
